//
//  SDCourseCell.swift
//  Seed
//
//  Created by Samuel on 2017/6/8.
//  Copyright © 2017年 RedSoft. All rights reserved.
//

import UIKit

class SDCourseCell: UITableViewCell {

    @IBOutlet weak var originalView: UIView!
    
    @IBOutlet weak var iconView: UIImageView!
    @IBOutlet weak var titleLabel: UILabel!
    @IBOutlet weak var contentLabel: UILabel!
    
    @IBOutlet weak var stateImgView: UIImageView!
    @IBOutlet weak var stateLabel: UILabel!
    @IBOutlet weak var courseNumLabel: UILabel!
    
    @IBOutlet weak var learnNumLabel: UILabel!
    @IBOutlet weak var priceLabel: UILabel!
    @IBOutlet weak var joinBtn: UIButton!
    
    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
        self.selectionStyle = .none
    }

    override func setSelected(_ selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        
        let bg = turquoiseColor()
        bg.frame = CGRect.init(x: 0, y: 0, width: SCREENW - 16, height: 206)
        originalView.layer.insertSublayer(bg, at: 0)
    }
    
    func turquoiseColor() -> CAGradientLayer {
        let topColor = UIColor.white
        let bottomColor = YMColor(r: 243, g: 243, b: 243, a: 1)
        let gradientColors: Array <AnyObject> = [topColor.cgColor, bottomColor.cgColor]
        let gradientLocations: Array <NSNumber> = [0.0 , 1.0]
        let gradientLayer: CAGradientLayer = CAGradientLayer()
        
        gradientLayer.colors = gradientColors
        gradientLayer.locations = gradientLocations
        return gradientLayer
    }
}
